package com.ldc.commonlibs.http;

import android.util.Log;

import androidx.annotation.NonNull;

import okhttp3.logging.HttpLoggingInterceptor;

public class ApiLogger implements HttpLoggingInterceptor.Logger {
    private final static String TAG = "=== 网络日志 ===";

    public static HttpLoggingInterceptor getLogger() {
        return getLogger(HttpLoggingInterceptor.Level.BODY);
    }

    public static HttpLoggingInterceptor getLogger(HttpLoggingInterceptor.Level level) {
        return new HttpLoggingInterceptor(new ApiLogger()).setLevel(level);
    }

    @Override
    public void log(@NonNull String s) {
        Log.e(TAG, s);
    }
}
